import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from "@/components/layout/Layout";
//防止路由重复点击报错
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'login',
    component: ()=>import("../views/Login/Login")
  },
  {
    path: '/dash',
    name: 'dash',
    component: Layout,
    children:[
      {
        path: '/',
        name: 'home',
        component: ()=>import('../views/home/index')
      },
      {
        path: '/user',
        name: 'user',
        component: ()=>import('../views/user/User')
      },
        {
            path: '/goodType',
            name:'goodType',
            component:()=>import("../views/goods/GoodType"),
            meta: { title: '商品类型', noCache: true },
        },
        {
            path: '/goodBrand',
            name:'goodBrand',
            component:()=>import("../views/goods/GoodBrand"),
            meta: { title: '商品品牌', noCache: true },
        },
        {
            path: '/goodInfo',
            name:'goodInfo',
            component:()=>import("../views/goods/GoodInfo"),
            meta: { title: '商品信息', noCache: true },
        },
        {
            path: '/tweetsChannel',
            name:'tweetsChannel',
            component:()=>import("../views/tweets/Channel"),
            meta: { title: '频道管理', noCache: true },
        },
        {
            path: '/tweetsArticle',
            name:'tweetsArticle',
            component:()=>import("../views/tweets/Article"),
            meta: { title: '文章管理', noCache: true },
        },
        {
            path: '/quoteBudget',
            name:'quoteBudget',
            component:()=>import("../views/quote/Budget"),
            meta: { title: '预算管理', noCache: true },
        },
        {
            path: '/quoteBudget',
            name:'quoteBudget',
            component:()=>import("../views/quote/Budget"),
            meta: { title: '预算管理', noCache: true },
        },
        {
            path: '/quotePrecept',
            name:'quotePrecept',
            component:()=>import("../views/quote/Precept"),
            meta: { title: '方案管理', noCache: true },
        },
        {
            path: '/quotePreceptFacility',
            name:'quotePreceptFacility',
            component:()=>import("../views/quote/PreceptFacility"),
            meta: { title: '方案设备管理', noCache: true },
        }
    ]
  },

]

const router = new VueRouter({
  routes
})

export default router
